//
// Created by grainlee on 16/9/12.
//
#include <iostream>
#include <vector>
using namespace std;


int maxArea(vector<int>& height) {
    int i,j;
    i = 0;
    j = height.size()-1;
    int max = 0;
    int size;

    while (i != j){
        if(height[i] > height[j]){
            size = height[j] * (j-i);
            if (size > max)
                max = size;
            j--;
        }else{
            size = height[i] * (j-i);
            if (size > max)
                max = size;
            i++;
        }
    }
    return max;

}

int main(){
    vector<int> height;
    height.push_back(1);
    height.push_back(3);
    height.push_back(2);
    cout << maxArea(height);
}